package com.base.cn.platform.os.controller.web.classes.topic.like;

import com.base.cn.platform.os.common.WebBaseController;
import com.base.cn.platform.os.service.course.classes.topic.like.ClassesTopicLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;

/**
 * 班级话题点赞
 *
 * @author SK
 * @since 2018-05-31
 */
@Controller
@RequestMapping("/web/classes/topic")
public class WebClassesTopicLikeController extends WebBaseController {

    @Autowired
    private ClassesTopicLikeService classesTopicLikeService;

    /**
     * 更新话题点赞
     *
     * @return 操作结果
     */
    @RequestMapping("/updateTopicLike")
    @ResponseBody
    public Map<String, Object> updateTopicLike(HttpServletRequest request,
                                               @RequestParam("topicId") BigDecimal topicId) {
        BigDecimal userId = webMobileLoginUtil.getLoginUserId(request);
        return classesTopicLikeService.saveClassesTopicLike(topicId, userId);
    }
}
